package com.kx.springboot.config;

import com.kx.springboot.servlet.MyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ServletConfig {
    /**
     * @Bean是个方法级别的注解，主要用在配置类
     * 相当于<beans><bean id="" class=""></bean></beans>
     * @return
     */
    @Bean
    public ServletRegistrationBean myServletRegistrationBean(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new MyServlet(),"/myservlet2");
        return servletRegistrationBean;
    }
}
